package com.yuxi.shuzu;

public class Demo3 {
    public static void main(String[] args) {
        int[] arr= {10,20,30,40,50,60};
        int maxIndex = getMaxindex(arr);
        System.out.println("maxIndex = " + maxIndex);
    }

    public static int getMaxindex(int[] arr) {
        int max = 0;
        for (int i = 0; i < arr.length; i++) {
            if (arr[i]>max){
                max = arr[i];
            }
        }
        for (int i = 0; i < arr.length; i++) {
            if (arr[i]==max){
                return i;
            }
        }
        return 0;
    }
}
